﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LINQToolKit
{
    /// <summary>
    /// Represents the base class for defining the association property for the objects
    /// </summary>
    /// <typeparam name="T">object</typeparam>
    /// <remarks>
    /// This framework is under the GNU licence and Creative Commons 3.0.
    /// You can also get a copy of the source code from google code
    /// <see cref="http://linqtodouban.googlecode.com/svn/trunk/"/>.
    /// For more information and further support, please contact with kevin (chwkai@gmail.com)
    /// </remarks>
    public abstract class AssociationObject<T> 
    {
        public IEntityProvider Provider { get; set; }
        public Uri Source { get; set; }

        public AssociationObject()
        {

        }

        public AssociationObject(Uri source)
        {
            this.Source = source;
        }

        public bool IsReady
        {
            get 
            {
                return this.Provider != null && 
                    this.Source != null && 
                    !this.Source.IsLoopback;
            }
        }
    }
}
